<template>
  <view class="action-buttons">
    <button 
      class="btn btn-primary" 
      @click="handlePrimaryAction"
      v-if="primaryAction"
    >
      <view class="btn-content">
        <text class="btn-icon" v-if="primaryAction.icon">{{ primaryAction.icon }}</text>
        <text class="btn-text">{{ primaryAction.text }}</text>
      </view>
    </button>
    
    <button 
      class="btn btn-secondary" 
      @click="handleSecondaryAction"
      v-if="secondaryAction"
    >
      <view class="btn-content">
        <text class="btn-icon" v-if="secondaryAction.icon">{{ secondaryAction.icon }}</text>
        <text class="btn-text">{{ secondaryAction.text }}</text>
      </view>
    </button>
  </view>
</template>

<script>
export default {
  name: 'ActionButtons',
  props: {
    primaryAction: {
      type: Object,
      default: null
    },
    secondaryAction: {
      type: Object,
      default: null
    }
  },
  methods: {
    handlePrimaryAction() {
      this.$emit('primary-action')
    },
    handleSecondaryAction() {
      this.$emit('secondary-action')
    }
  }
}
</script>

<style lang="scss" scoped>
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 24rpx;
  padding: 40rpx 30rpx;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 24rpx 24rpx 0 0;
  box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
  margin-top: 20rpx;
}

.btn {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 16rpx;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  &:active {
    transform: scale(0.96);
  }
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
  }
  
  &:hover::before {
    left: 100%;
  }
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16rpx;
  padding: 28rpx 40rpx;
  font-size: 32rpx;
  font-weight: 600;
  border-radius: 16rpx;
}

.btn-primary {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #ffffff;
    box-shadow: 0 8rpx 24rpx rgba(24, 144, 255, 0.3);
    border-radius: 44rpx; /* 匹配submit-btn的圆角 */
    
    .btn-content {
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
      height: 88rpx; /* 匹配submit-btn的高度 */
      line-height: 88rpx; /* 匹配submit-btn的行高 */
    }
    
    &:hover {
      box-shadow: 0 12rpx 32rpx rgba(24, 144, 255, 0.4);
      transform: translateY(-2rpx);
    }
    
    &:active {
      box-shadow: 0 4rpx 16rpx rgba(24, 144, 255, 0.3);
    }
  }

.btn-secondary {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #495057;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  
  .btn-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
  }
  
  &:hover {
    box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
    transform: translateY(-2rpx);
  }
  
  &:active {
    box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
  }
}

.btn-icon {
  font-size: 36rpx;
  font-weight: normal;
}

.btn-text {
  font-size: 32rpx;
  letter-spacing: 1rpx;
}
</style>